home *** CD-ROM | disk | FTP | other *** search
- Path: mailhub.scitec.com.au!ramsesy
- From: ramsesy@rd.scitec.com.au (Ramses Youhana)
- Newsgroups: comp.lang.c
- Subject: Re: sscanf bug??????
- Date: 22 Feb 1996 07:45:19 GMT
- Organization: SCITEC LIMITED, Sydney, Australia.
- Distribution: world
- Message-ID: <4gh6uf$i2@mailhub.scitec.com.au>
- References: <4fimvo$82s@fnord.dfw.net> <10FEB199622213548@erich.triumf.ca> <824160515snz@genesis.demon.co.uk>
- NNTP-Posting-Host: scitec7.scitec.com.au
- X-Newsreader: TIN [version 1.2 PL2]
-
- Lawrence Kirby (fred@genesis.demon.co.uk) wrote:
- > In article <10FEB199622213548@erich.triumf.ca>
- > bennett@erich.triumf.ca "P.Bennett" writes:
-
- > >Borland says that you need to use "%ld" for long ints in both printf() and
- > >scanf(). If ints and longs are the same size (as on many unix systems, I
- > >believe) "%d" and "%ld" can be used interchangeably, but if they are not the
- > >same (as on MS-DOS) then it _does_ make a difference.
-
- > Please, *never* treat %d and %ld as interchangeable or suggest that others
- > could do so.
-
- I agree.
-
- You need the %ld for 16 bit processors or processors running in 16 bit mode.
- Unfortunately, your stuck with this when using a PC (using 16 bit mode).
- With 32 bit processors (such as a M68302 micro-controller) you don't need
- the %ld. %d will do as the processor treats the number as a 32 bit entity
- anyway. You have to be careful when saying that %ld and %d are interchangeable,
- as a compiler for a 32 bit processor (such as the M68302) may not support the
- "l" in the %ld format.
-
-